package com.eight.cloud.openfeign.message.api;

import com.eight.cloud.openfeign.message.model.MqMessage;
import com.eight.cloud.openfeign.message.model.SocketMessage;
import com.eight.cloud.core.global.result.Result;
import com.eight.cloud.openfeign.message.factory.MessageFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @InterfaceName: MessageClient
 * @Author: TXC
 * @Date: 2024-10-11 14:10
 **/
@FeignClient(value = "cloud-websocket", contextId = "messageClient", fallbackFactory = MessageFallbackFactory.class)
public interface MessageClient {
    /**
     * 发送消息
     * @param socketMessage 消息
     */
    @PostMapping("/publish/websocket")
    Result<String> sendWebSocketMessage(@RequestBody SocketMessage<?> socketMessage);

    /**
     * 发送mq消息
     * @param mqMessage 消息
     */
    @PostMapping("/publish/mq")
    Result<String> sendRabbitMessage(@RequestBody MqMessage<?> mqMessage);
}
